package com.byedu.domain.course.vo;


import com.byedu.domain.course.LibraryDO;
import com.byedu.model.enums.LibraryTypeEnum;

import java.io.Serializable;
import java.util.List;

public class LibraryAllVO implements Serializable {

    private static final long serialVersionUID = -2834770389554864551L;

    /*题库编号*/
    private Integer id;
    /*题库名称*/
    private String name;
    /*课程编号*/
    private Integer courseId;
    /*试用的题目数量*/
    private int trialNum;
    /*题库类型*/
    private String libType;
    /*类型名称*/
    private String libTypeName;

    /*试卷拥有的题目数*/
    private int questionNum;

    public String getLibraryType() {
        return libraryType;
    }

    public void setLibraryType(String libraryType) {
        this.libraryType = libraryType;
    }

    private String libraryType;

    private List<QuestionVO> questionVOList;

    public LibraryAllVO () {}

    public LibraryAllVO (LibraryDO libraryDO, List<QuestionVO> questionVOList) {
        this.id = libraryDO.getId();
        this.courseId = libraryDO.getCourseId();
        this.name = libraryDO.getName();
        this.libraryType=libraryDO.getLibraryType();
        this.questionVOList = questionVOList;
        this.questionNum = libraryDO.getQuestionNum();
    }

    public LibraryAllVO (LibraryDO libraryDO) {
        this.id = libraryDO.getId();
        this.courseId = libraryDO.getCourseId();
        this.name = libraryDO.getName();
        this.libraryType=libraryDO.getLibraryType();
        this.trialNum = libraryDO.getTrialNum();
        this.libTypeName = LibraryTypeEnum.valueOf(this.libraryType).getTitle();
        this.questionNum = libraryDO.getQuestionNum();
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getCourseId() {
        return courseId;
    }

    public void setCourseId(Integer courseId) {
        this.courseId = courseId;
    }

    public List<QuestionVO> getQuestionVOList() {
        return questionVOList;
    }

    public void setQuestionVOList(List<QuestionVO> questionVOList) {
        this.questionVOList = questionVOList;
    }

    public int getTrialNum() {
        return trialNum;
    }

    public void setTrialNum(int trialNum) {
        this.trialNum = trialNum;
    }

    public String getLibType() {
        return libType;
    }

    public void setLibType(String libType) {
        this.libType = libType;
    }

    public String getLibTypeName() {
        return libTypeName;
    }

    public void setLibTypeName(String libTypeName) {
        this.libTypeName = libTypeName;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        LibraryAllVO libraryVO = (LibraryAllVO) o;

        if (id != null ? !id.equals(libraryVO.id) : libraryVO.id != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return id != null ? id.hashCode() : 0;
    }

    @Override
    public String toString() {
        return "LibraryVO{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", courseId=" + courseId +
                ", trialNum=" + trialNum +
                ", libType=" + libType +
                '}';
    }

    public int getQuestionNum() {
        return questionNum;
    }

    public void setQuestionNum(int questionNum) {
        this.questionNum = questionNum;
    }
}
